package pattern.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import pattern.feign.fallback.FileFeignFallBack;
import pattern.feign.fallback.SocketFeignFallBack;
import pattern.model.mq.SendMessageManyModel;
import pattern.model.mq.SendMessageModel;
import pattern.model.mq.SendMessageTokenModel;
import pattern.model.mq.SendMessageTopicModel;
import pattern.result.ResponseData;
import pattern.result.SocketResult;

/**
 * 文件服务feign
 * @author Simon
 */
@FeignClient(contextId = "fileFeign", value = "${cloud.application.name.file-server}", fallback = FileFeignFallBack.class)
public interface FileFeign {

    @PostMapping(value = "/file/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseData fileupload(@RequestParam(value ="file")@RequestPart(value = "file") MultipartFile file, @RequestParam(value  = "fileName") String fileName, @RequestParam(value  = "bucket") String bucket);

    /**
     * 上传文件指定位置
     */
    @PostMapping(value = "/file/uploadPath",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseData uploadPath(@RequestParam(value = "file") @RequestPart(value = "file") MultipartFile file,@RequestParam(value  = "bucket") String bucket,@RequestParam(value  = "fileName") String fileName,@RequestParam(value  = "path") String path);
}
